Thread: use ^ with non integers

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    12

    use ^ with non integers

    Is it possible to raise a non integer value to a power?

    e.g.

    num = 5.2 ^ 3

  2. #2
    Registered User ledow's Avatar
    Join Date
    Dec 2011
    Posts
    435
    Yes. But not with '^'.

    pow - C++ Reference

    - Compiler warnings are like "Bridge Out Ahead" warnings. DON'T just ignore them.
    - A compiler error is something SO stupid that the compiler genuinely can't carry on with its job. A compiler warning is the compiler saying "Well, that's bloody stupid but if you WANT to ignore me..." and carrying on.
    - The best debugging tool in the world is a bunch of printf()'s for everything important around the bits you think might be wrong.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    And just to be clear, even using ^ with integers does not perform a power operation. It's the XOR operator!
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 03-26-2012, 10:50 AM
  2. need help with integers
    By tomisme in forum C Programming
    Replies: 10
    Last Post: 05-29-2008, 01:04 AM
  3. 20 integers
    By bazzano in forum C Programming
    Replies: 11
    Last Post: 04-03-2007, 08:06 AM
  4. sum of integers
    By campermama in forum C++ Programming
    Replies: 12
    Last Post: 06-05-2004, 12:20 AM
  5. Integers
    By Marky_Mark in forum Windows Programming
    Replies: 1
    Last Post: 11-26-2001, 04:56 PM